import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  // 启用实验性功能以提升性能
  experimental: {
    optimizeCss: true,
    optimizePackageImports: ['antd', '@ant-design/icons'],
  },
  // 压缩配置
  compress: true,
  // 图片优化
  images: {
    formats: ['image/webp', 'image/avif'],
  },
  // 输出配置
  output: 'standalone',
  // 编译器配置
  compiler: {
    removeConsole: process.env.NODE_ENV === 'production',
  },
  // 性能优化
  swcMinify: true,
  // 页面预加载
  async headers() {
    return [
      {
        source: '/(.*)',
        headers: [
          {
            key: 'X-DNS-Prefetch-Control',
            value: 'on'
          }
        ],
      },
    ]
  },
};

export default nextConfig;
